<template>
  <div class='page white-stage'>
    <top-filter :filterOptions="filterOptions" @change-filter="changeFilterValue"></top-filter>
    <div class="container pdt grey" :style="containerHeight">
      <div class="clients-list">
        <scroller style="top:44px" class="pdscroll" :on-infinite="load" :on-refresh="refresh" ref="my_scroller" :noDataText="noDataText">
          <clientseas-item @on-click="onItemClick" v-for="(client, index) in clientList" :key="index" :client="client"></clientseas-item>
        </scroller>
      </div>
    </div>

    <crm-cover v-if="isShowCover" :hideCoverOnClick="true"></crm-cover>
    <crm-tabbar :activeItem='activeItem'></crm-tabbar>

    <popup v-model="show" @on-hide="handlePopup('hide')" @on-show="handlePopup('show')" height="100%">
      <div class="popup0" v-if="show === true">
      <scroller style="top:44px" class="pdscroll" :on-infinite="refreshMember" :on-refresh="loadMember" ref="team_scroller" :noDataText="tnoDataText">
        <div :style="containerHeight" @click="hidePopup">
          <team-member-item @on-click="memberSelect" v-for="(teamMemberItem, index) in teamsMembers" :key="index" :client="teamMemberItem"></team-member-item>
        </div>
      </scroller>
      </div>
    </popup>
  </div>

</template>
<script>
  import Vue from 'vue'
  import crmTabbar from '../components/crm-tabbar'
  import crmCover from '../components/crm-cover'
  import topFilter from '../components/top-filter'
  import teamMemberItem from '../components/team-member-item'
  import clientseasItem from '../components/clientseas-item'
  import Scroller from 'vue-scroller'

  import {Popup} from 'vux'

  import store from '../store'

  import dropdownOption from '../components/dropdown-option';

  import {
    SHOW_COVER
  } from '../store/mutation-types';


  export default {
  data () {

    let overHeight = document.body.scrollHeight+10;

    return {
      isMore: false,
      activeItem:'',
      containerHeight : 'height:'+overHeight+'px;',
      page_size : 5,
      page_index: 1,
      team_page_index: 1,
      custom_type:0,
      show: false,
      noDataText:'',
      tnoDataText:'',
      originNoDataText:'暂无数据',
      clientList:[
        // {
        //   id:1001,
        //   suid:1001,
        //   head_img_url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489838952537&di=4c3fd0bad205ed237e850ca4ee4ddcdc&imgtype=0&src=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F279759ee3d6d55fbdf1e87f969224f4a21a4dd11.jpg',
        //   nick_name: '林丽勤',
        //   parent_name : '刘涛',
        //   custom_property : "YCJ",
        //   custom_status: 'INT',
        //   last_contact_time: '2017-03-22 15:46:35',
        //   is_manager: 1,
        //   counselorLink:'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   clientLink:'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   stateLink: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   labels:[
        //     {
        //     name: '一岁半宝宝',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //     },
        //
        //     {
        //     name: '金融',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //     },
        //
        //     {
        //     name: '初步融洽',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //     },
        //   ]
        // },
        // {
        //   id:1002,
        //   suid:1002,
        //   head_img_url: 'https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/image/h%3D360/sign=e105b9f1d61b0ef473e89e58edc651a1/b151f8198618367a9f738e022a738bd4b21ce573.jpg',
        //   nick_name: '李晶晶',
        //   parent_name : '陈芳芳',
        //   custom_property : "YB#",
        //   custom_status: 'INT',
        //   last_contact_time: '2017-03-22 15:46:35',
        //   counselorLink:'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   clientLink:'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   stateLink: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   labels:[
        //   {
        //     name: '一岁半宝宝',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //   },
        //
        //   {
        //     name: '金融',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //   },
        //
        //   {
        //     name: '初步融洽',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //   },
        //   ]
        // },
        // {
        //   id:1003,
        //   suid:1003,
        //   head_img_url: 'https://ss3.baidu.com/9fo3dSag_xI4khGko9WTAnF6hhy/image/h%3D360/sign=4b4e4613d443ad4bb92e40c6b2035a89/03087bf40ad162d960aed9aa14dfa9ec8b13cdc0.jpg',
        //   nick_name: '郭美美',
        //   parent_name : '陈芳芳',
        //   custom_property : "YX#",
        //   custom_status: 'INT',
        //   last_contact_time: '2017-03-22 15:46:35',
        //   counselorLink:'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   clientLink:'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   stateLink: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0',
        //   labels:[
        //   {
        //     name: '一岁半宝宝',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //   },
        //
        //   {
        //     name: '金融',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //   },
        //
        //   {
        //     name: '初步融洽',
        //     link: 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3&step_word=&hs=2&pn=10&spn=0&di=0&pi=21202519877&rn=1&tn=baiduimagedetail&is=0%2C36045&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=750690187%2C2913691576&os=&simid=&adpicid=0&lpn=0&ln=33820&fr=&fmq=1489826129137_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=girl&bdtype=-1&oriquery=&objurl=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fb151f8198618367a9f738e022a738bd4b21ce573.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3B08ma_z%26e3Bv54AzdH3F4jtgeAzdH3Fd8ccnAzdH3F&gsm=&rpstart=0&rpnum=0'
        //   },
        //   ]
        // }
      ] ,
      filterOptions: [],
      teamFilterOptions:[],
      teamsMembers:[],
      selectedClientId: null,
      filterData:{},
    };
  },

  components: {
    crmTabbar,
    crmCover,
    topFilter,
    clientseasItem,
    Popup,
    teamMemberItem,
    Scroller
  },

  mounted() {
    this.callJsApi('biz.navigation.setTitle',{title:'工作台'});
  },

  watch:{
  },

  methods: {
    refresh (iscroll) {

    console.log('refresh')

    this.page_index++;

    this.getCustoms();

    // Refresh current data
    },

    log () {
    console.log('ee');
    },

    load (iscroll) {
    console.log('load')
    this.page_index++;
    this.getCustoms();
    // Load new data
    },

    refreshMember (iscroll) {
    this.team_page_index++;
    this.loadMembers();
    console.log('refreshMember')
    // Refresh current data
    },

    logMember () {
    console.log('logMember');
    },

    loadMember (iscroll) {
    console.log('loadMember')
    this.team_page_index++;
    this.loadMembers();
    // Load new data
    },

    hidePopup () {
    alert('你取消了分配！');
    this.show = false;
    console.log('hidePopup')
    },

    test () {
    console.log('test')
    },

    onItemClick(clientID){
    this.teamsMembers = [];
    this.loadMembers();
    this.show = true;
    this.selectedClientId = clientID;
    console.log('clientID: ', clientID);
    },

    memberSelect(member) {
    console.log('memberSelect: ', member.suid);

    let info = {
      taget_suid: member.suid,
      custom_id: this.selectedClientId,
      distribute_type: 'GH#',
      opt_type: 'TPT'
    };

    let that = this;

    store.dispatch('distribute', info).then((response) => {
      if(response.data.errcode === 0) {
      alert('您将客户分配给成员：'+member.name);
      that.show = false;
      // that.$router.back();
      } else {
      console.log(JSON.stringify(response.data));
      }
    }).catch((error) => {
      console.log(error)
    });

    // let response = {errcode:0};
    // console.log(response.errcode, 'response.errcode')
    // if(response.errcode === 0) {
    //   alert('您将客户分配给成员：'+member.nick_name);
    //   that.show = false;
    //   // that.$router.back();
    // } else {
    //   alert('系统错误！请联系管理员!');
    //   console.log(JSON.stringify(response));
    // }
    },

    getCustoms(data) {

      let defaultData = {} ;
      let that = this;

      console.log('this.custom_type', this.custom_type)

      defaultData['custom_type'] = this.custom_type;
      defaultData['page_size'] = this.page_size;
      defaultData['page_index'] = this.page_index;
      defaultData['order_by'] = 0;

      data = Object.assign(defaultData, data);

      console.log('getCustoms JSON.stringify(data)', JSON.stringify(data));

      store.dispatch('getCustoms', data).then((response) => {
      if(response.data.errcode == 0) {
        that.clientList = that.clientList.concat(response.data.results.data);
        setTimeout(() => {
        if (that.$refs.my_scroller) {
          that.$refs.my_scroller.finishInfinite(true);
          that.$refs.my_scroller.finishPullToRefresh();
        }
        }, 1500)

        if(that.clientList.length) {
        that.noDataText = '';
        }

      } else {
        console.log('系统服务异常！请联系管理员!', JSON.stringify(response.data));
      }
      }).catch((error) => {
      console.log(error)
      })
    },

    loadMembers () {

      let that = this;
      let params = {page_index: this.team_page_index, page_size:this.page_size};

      store.dispatch('getTeams', params).then((response) => {
      let teams = response.data.results.teams;
      setTimeout(() => {
        if (that.$refs.team_scroller) {
        that.$refs.team_scroller.finishInfinite(true);
        that.$refs.team_scroller.finishPullToRefresh();
        }
      }, 1500)
      that.filterUserFromTeam(teams);
      if(that.teamsMembers.length) {
        that.tnoDataText = '';
      }
      that.team_page_index++;
      });
      // let response =  {
      //   "errcode": 0,
      //   "errmsg": "接口调用成功!",
      //   "results": {
      //     "total": 1,
      //     "page_index": 1,
      //     "page_size": 10,
      //     "teams": [
      //     {
      //       "id": 3,
      //       "parent_id_str": "",
      //       "parent_id": 0,
      //       "site_id": 0,
      //       "parent_name": "",
      //       "team_name": "营销A队",
      //       "insert_time": "2017-03-27 18:58:02",
      //       "update_time": "2017-03-27 18:58:02",
      //       "team_managers": [
      //       {
      //         "id": 4,
      //         "suid": 3,
      //         "team_id": 3,
      //         "nick_name" : "李娜",
      //         "head_img_url":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489838952537&di=4c3fd0bad205ed237e850ca4ee4ddcdc&imgtype=0&src=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F279759ee3d6d55fbdf1e87f969224f4a21a4dd11.jpg",
      //         "insert_time": "2017-03-27 18:58:02",
      //         "update_time": "2017-03-27 18:58:02",
      //         "status": "OK##",
      //         "is_team_manager": 1
      //       }
      //       ],
      //       "team_members": [
      //       {
      //         "id": 5,
      //         "suid": 3,
      //         "team_id": 3,
      //         "head_img_url":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489838952537&di=4c3fd0bad205ed237e850ca4ee4ddcdc&imgtype=0&src=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F279759ee3d6d55fbdf1e87f969224f4a21a4dd11.jpg",
      //         "nick_name" : "Evan",
      //         "insert_time": "2017-03-27 18:58:02",
      //         "update_time": "2017-03-27 18:58:02",
      //         "status": "OK##",
      //         "is_team_manager": 0
      //       },
      //
      //       {
      //         "id": 6,
      //         "suid": 7,
      //         "team_id": 3,
      //         "head_img_url":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489838952537&di=4c3fd0bad205ed237e850ca4ee4ddcdc&imgtype=0&src=http%3A%2F%2Ff.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F279759ee3d6d55fbdf1e87f969224f4a21a4dd11.jpg",
      //         "nick_name" : "王强",
      //         "insert_time": "2017-03-27 18:58:02",
      //         "update_time": "2017-03-27 18:58:02",
      //         "status": "OK##",
      //         "is_team_manager": 1
      //       }
      //       ]
      //     }
      //     ]
      //   }
      //   };



      // this.$refs.iscroll.refresh()
    },
    //从接口中筛选出团队信息
    filterUserFromTeam(teams) {
    let temps = [];
    teams.forEach(function(team, index){
      team.team_members.forEach(function(member, mindex){
      member.team_name = team.team_name;
      temps.push(member);
      });
    });
    this.teamsMembers = this.teamsMembers.concat(temps);
    console.log('this.teamsMembers', JSON.stringify(this.teamsMembers));
    },

    //筛选器
    changeFilterValue(filterOptions){

    var submitData = {};
    this.page_index = 0;
    filterOptions.forEach(function(object, index){
      if(object.options) {
      object.options.forEach(function(secObject, secIndex) {
        submitData[secObject.name] = secObject.checked;
      });
      }
      else {
      submitData[object.name] = object.checked;
      }
    });
    this.filterData = submitData;
    this.getCustoms();
    },

    handlePopup(status){
    console.log('222')
    this.team_page_index = 0;

    if(status === 'show') {
    } else {

    }
    }

  },

  computed:{

    isShowCover() {
    return this.$store.state.app.isShowCover
    },

    gbfilterOptions() {
    return this.$store.state.app.filterOptions;
    }

  },

  mounted() {

    let query = this.$route.query;
    this.custom_type = query.custom_type;
    this.activeItem = query.activeItem;

    console.debug('custom_type', this.custom_type);
    console.debug('activeItem', this.activeItem);
    this.noDataText = this.originNoDataText;
    this.tnoDataText = this.originNoDataText;

    this.filterOptions = this.gbfilterOptions;
    this.teamFilterOptions = this.gbfilterOptions;

    this.callJsApi('biz.navigation.setTitle',{title:query.title});

    // this.getCustoms();
    // this.loadMembers();
  }


  }
</script>
<style lang="less">

  @import "../less/base";

  .clients-list{
    // margin-top: 20px;
    background-color: #EFEFF4;
    // padding-top: 10px;
  }


  .grey.container.pdt{
    // padding-top: 18px;
  }
</style>
